<template>
  <n-layout style="height: 100vh">
    <n-layout-header style="height: 64px; padding: 24px" bordered>
      <n-h2>DEMO <span>版本号: {{ state.appVersion }}</span></n-h2>
    </n-layout-header>
    <n-layout position="absolute" style="top: 64px" has-sider>
      <n-layout-sider content-style="padding: 24px;" :native-scrollbar="false" bordered>
        <WarehouseMenu />
      </n-layout-sider>
      <n-layout content-style="padding: 24px;" :native-scrollbar="false">
        <RouterView></RouterView>
      </n-layout>
    </n-layout>
    <!-- <n-layout-footer position="absolute" style="height: 64px; padding: 24px" bordered>
        城府路
      </n-layout-footer> -->
  </n-layout>
</template>
<script lang="ts" setup>
import { NLayout, NLayoutSider, NLayoutHeader, NH2 } from 'naive-ui'
import WarehouseMenu from '../components/WarehouseMenu.vue'
import { onMounted, reactive } from 'vue';
const state = reactive({
  appVersion: ''
}) as any
console.log(window.electron)

async function getAppVersion() {
  window.electron.ipcRenderer.send('set-title', '前端修改标题')

  const appVersion = await window.electron.ipcRenderer.invoke('get-app-version')
  console.log('appVersion:', appVersion)
  state.appVersion = appVersion

  const userData = await window.electron.ipcRenderer.invoke('get-user-data', 13)
  console.log('用户数据:', userData) // 输出: 用户数据: { name: 'John Doe', age: 30 }
}

onMounted(() => {
  getAppVersion()
})
</script>
